*********************************
***  Turkey paper - Data analysis
*** Last updated:  05/08/2024 in Stata 18
clear all

*Use main dataset

*** DEFINING GLOBALS

global items_all cn_ottoman_1  pride_national pride_religious ci_lifequality strongleader limitedelections rn_media_1 trust_religiousauthority trust_elections trust_presidentialsystem trust_parliament trust_military an_akpstate_1 an_erdoganmission_1 an_erdoganinspiring_1 an_akpmuslims_1 success_economyminister success_erdogan  policy_economy policy_povertyreduction policy_internalsecurity

global items_reducedTrust cn_ottoman_1  pride_national pride_religious ci_lifequality strongleader limitedelections rn_media_1 trust_religiousauthority trust_elections trust_presidentialsystem an_akpstate_1 an_erdoganmission_1 an_erdoganinspiring_1 an_akpmuslims_1 success_economyminister success_erdogan  policy_economy policy_povertyreduction policy_internalsecurity

global itemsnotrust cn_ottoman_1  pride_national pride_religious ci_lifequality strongleader limitedelections rn_media_1 an_akpstate_1 an_erdoganmission_1 an_erdoganinspiring_1 an_akpmuslims_1 success_economyminister success_erdogan  policy_economy policy_povertyreduction policy_internalsecurity

global normative cn_ottoman_1  pride_national pride_religious strongleader limitedelections rn_media_1 an_akpstate_1 an_erdoganmission_1 an_erdoganinspiring_1 an_akpmuslims_1

global instrumental ci_lifequality success_economyminister success_erdogan policy_economy policy_povertyreduction policy_internalsecurity


global support normative instrumental itemsnotrust
global support2 normative2 instrumental


global controls age female i.educ_cat interest partisan i.religious i.urban_dum income econ_change

global outcomes likel_voteforregime likel_abstain likel_opposition1 likel_opposition2  mobilizationforakp
global outcomes2 likel_voteforregime likel_abstain likel_opposition1 likel_opposition2  

global blame blame_erdogan blame_economyministers blame_centralbank blame_externalfactors

**----------
** 1. Relationship between instrumnental and normative support 

bys regimevoter: corr $support 
corr $support
tab study

*----------------------------------------------------------------------------------
** TABLE 1: Descriptive results: Average autocratic system support by 2018 votes

*All
sum $support [aweight=weight] if study==2

*Government
sum $support [aweight=weight] if study==2 & regimevoter==1 

*Opposition
sum $support [aweight=weight] if study==2 & oppositionvoter==1 

*Abstention
sum $support [aweight=weight] if study==2 & notvoted==1 


tab treatment study if regimevoter==1

tab1 normative instrumental [aweight=weight] if study==2 & regimevoter==1 

*----------------------------------------------------------------------------------
*Figure 1: Macro data Turkey


** Figure 2: Autocratic system support by 2018 votes


set scheme plotplain
twoway(kdensity itemsnotrust [aweight=weight] if regimevoter==1) (kdensity normative [aweight=weight] if regimevoter==0), note(" ") legen(off) name(combined, replace)  title("Combined Support", size(vlarge)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medium)) ytitle(kdensity combined, size(large)) scheme(plotplain)

twoway(kdensity normative [aweight=weight] if regimevoter==1) (kdensity normative [aweight=weight] if regimevoter==0), note(" ") legen(off) name(norm, replace)  title("Normative Support", size(vlarge)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medium)) ytitle(, size(large)) scheme(plotplain)

twoway(kdensity instrumental [aweight=weight] if regimevoter==1) (kdensity instrumental [aweight=weight] if regimevoter==0), note(" ") name(inst, replace)  title("Instrumental Support", size(vlarge)) xtitle(" ") ylabel(, labsize(medlarge)) xlabel(, labsize(medium)) ytitle(, size(large)) legend(lab(1 "Government voters") lab(2 "Non-government voters") size(medlarge) order(1 2) row(2) region(lcolor(white)) pos(2) ring(0))

*----------------------------------------------------------------------------------
** Figure 3: Impact of crisis treatment on autocratic system support: Regression coefficients and 95% confidence intervals.


*Testing Hypothesis 4: While instrumental forms of support shift in response to information about negative policy performance, normative forms of support do not. 

capture erase "${results}Results_h4.xls"
capture erase "${results}Results_h4.txt"

foreach k of varlist $support  {

reg `k' treatment if study==1 & regimevoter==1
estimates store `k'
outreg2  using "${results}Results_h4.xls", ///
bracket bdec(3) sdec(3) append

reg `k' treatment $controls if study==1 & regimevoter==1
estimates store `k'_2
outreg2  using "${results}Results_h4.xls", ///
bracket bdec(3) sdec(3) append

}

coefplot $support, drop (_cons) xline (0) scheme(plotplain)  legend(lab(2 "Normative support") lab(4 "Instrumental support") lab(6 "Combined support") size(medium)  region(lcolor(white)) order(2 4 6 8 10 12)) name(h4_gov, replace) title("Government voters", size(large))ylabel(,labsize(medium)) xlabel(-6(2)4)

** Opposition
foreach k of varlist $support  {

reg `k' treatment if study==1 & regimevoter==0
estimates store `k'
outreg2  using "${results}Results_h4.xls", ///
bracket bdec(3) sdec(3) append

reg `k' treatment $controls if study==1 & regimevoter==0
estimates store `k'_f
outreg2  using "${results}Results_h4.xls", ///
bracket bdec(3) sdec(3) append

}

coefplot $support, drop (_cons) xline (0) scheme(plotplain)  legend(lab(2 "Normative support") lab(4 "Instrumental support") lab(6 "Combined support") size(medium)  region(lcolor(white)) order(2 4 6 8 10 12)) name(h4_opp, replace) title("Non-Government voters", size(large)) ylabel(,labsize(medium)) xlabel(-6(2)4)

graph combine h4_gov h4_opp, col(1)




*----------------------------------------------------------------------------------
** Figure 4: Impact of crisis treatment on vote likelihood and AKP mobilization: Regression coefficients and 95% confidence intervals.

capture erase "${results}Results_h5_1.xls"
capture erase "${results}Results_h5_1.txt"

sum $outcomes, d

foreach k of varlist $outcomes {

reg `k' treatment income if study==2 & regimevoter==1 
estimates store `k'
outreg2  using "${results}Results_h5_1.xls", ///
bracket bdec(3) sdec(3) append

reg `k' treatment $controls if study==2 & regimevoter==1 
estimates store `k'2
outreg2  using "${results}Results_h5_1.xls", ///
bracket bdec(3) sdec(3) append

}

coefplot $outcomes, drop (_cons income) xline (0) scheme(plotplain)  legend(lab(2 "Likely vote: AKP+MHP") lab(4 "Likely vote: Abstain") lab(6 "Likely vote: Nation Alliance") lab(8 "Likely vote: HDP") lab(10 "Mobilize for AKP") size(medsmall) region(lcolor(white)) order(2 4 6 8 10)) name(h5_gov, replace) title("Government voters", size(large)) ylabel(,labsize(medium)) xlabel(-.6(.2).4)


foreach k of varlist $outcomes2 {

reg `k' treatment if study==2 & regimevoter==0
estimates store `k'
outreg2  using "${results}Results_h5_1.xls", ///
bracket bdec(3) sdec(3) append

reg `k' treatment $controls if study==2 & regimevoter==0
estimates store `k'2
outreg2  using "${results}Results_h5_1.xls", ///
bracket bdec(3) sdec(3) append

}

coefplot likel_voteforregime likel_abstain likel_opposition1 likel_opposition2 , drop (_cons income) xline (0) scheme(plotplain)  legend(lab(2 "Likely vote: AKP+MHP") lab(4 "Likely vote: Abstain") lab(6 "Likely vote: Nation Alliance") lab(8 "Likely vote: HDP")  size(medsmall) region(lcolor(white)) order(2 4 6 8 10)) name(h5_opp, replace) title("Non-Government voters", size(large)) ylabel(,labsize(medium)) xlabel(-.6(.2).4)

graph combine h5_gov h5_opp, col(1)



*** T-Test of coefficients

global outcomes likel_voteforregime likel_abstain likel_opposition1 likel_opposition2  mobilizationforakp



reg likel_voteforregime treatment income if study==2 & regimevoter==1 
estimates store AKP

gen treat = treatment

reg likel_opposition1 treat income if study==2 & regimevoter==1 
estimates store opp

suest AKP opp
test treatment - treat = 0


********
** Figure 5: Interaction between economic crisis treatment and system support on likelihood to vote for government parties. Marginal effects and 95% confidence intervals. Government voters only!


set scheme plotplain

interflex likel_voteforregime treatment instrumental  income normative if study==2 & regimevoter==1, type(linear) xlabel("Instrumental Support") ylabel (Regime Vote) dlabel (Treatment) sav(figa)
graph save  "${graphs}interflex_inst.gph",  replace

interflex likel_voteforregime treatment normative  income instrumental if study==2 & regimevoter==1, type(linear) xlabel(Normative Support) ylabel (Regime Vote) dlabel (Treatment) sav(figb)
graph save  "${graphs}interflex_norm.gph",  replace

interflex likel_voteforregime treatment itemsnotrust income if study==2 & regimevoter==1, type(linear) xlabel(Combined Support) ylabel (Regime Vote) dlabel (Treatment) sav(figc)
graph save  "${graphs}interflex_combined.gph",  replace

graph combine "${graphs}interflex_inst.gph" "${graphs}interflex_norm" "${graphs}interflex_combined", xsize(10) ysize(5) col(3)

  
*----------------------------------------------------------------------------------
** Figure 6: Impact of negative economic evaluations (marginal effects and 95% confidence interval) by feeling thermometer score for the AKP on 2018 vote for the AKP.

*Use CSES dataset

interflex vote_akp economyworse feeling_akp  education age female income if akpvoter==1 & wave==1 [aweight=weight], type(linear) xlabel("Feeling Score for AKP") ylabel (Regime Vote) dlabel (Treatment) sav(figa)




